export const state=()=>({
    token:'',
    success: false, // true成功 false失败
    code: 20001, // 20000正常
    message: "未登录", 
    data:{}
  })
   
  export const mutations = {
    M_UPDATE_USER_TOKEN(user,payload){
      user.success = payload.success;
      user.code = payload.code;
      user.data = payload.data;
      user.message = payload.message;
      user.token = payload.data.token;
    },
    M_UPDATE_USER_INFO(user,payload){
      console.log("M_UPDATE_USER_INFO==>",payload)
      user.success = payload.success;
      user.code = payload.code;
      user.message = payload.message;
      user.data = payload.data;
    }
  }
   
  export const actions = {
    A_UPDATE_USER({commit,user},payload){
      //..异步业务
      commit('M_UPDATE_USER',payload)
    }
  }

//getters 状态： 接收state作为参数，用于计算、过滤等
export const getters = {
    G_UPDATE_USER(state){
        return state.err == 1 ? '无数据' : state.data
    }
}